<template>
  <div>
    <el-form ref="pamarsRef" :inline="true" :model="pamars">
      <el-form-item label="会员姓名" prop="name">
        <el-input v-model="pamars.name" placeholder="会员姓名、昵称" clearable></el-input>
      </el-form-item>
      <el-form-item label="会员手机号" prop="mobile">
        <el-input v-model="pamars.mobile" placeholder="会员手机号" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="success" @click="getDataList()">查询</el-button>
        <el-button type="warning" @click="resetPamars()">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="dataList" border style=" width: 100%">
      <el-table-column prop="mobile" align="center" label="会员手机号">
      </el-table-column>
      <el-table-column prop="real_name" align="center" label="会员姓名">
      </el-table-column>
      <el-table-column prop="nickname" align="center" label="会员昵称">
      </el-table-column>
      <el-table-column prop="entry_before" align="center" label="修改前贡献值">
      </el-table-column>
      <el-table-column prop="entry_value" align="center" label="修改贡献值额度">
      </el-table-column>
      <el-table-column prop="entry_after" align="center" label="修改后贡献值">
      </el-table-column>
      <el-table-column prop="bill_type" align="center" label="事件类型">
        <template slot-scope="{row}">
          <div>{{ row.bill_type == 0 ? '扣除' : '增加' }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="mode" align="center" label="事件描述">
      </el-table-column>
      <el-table-column prop="format_create_time_millis" align="center" label="入账事件">
      </el-table-column>
      <el-table-column prop="operator" align="center" label="操作人">
      </el-table-column>
    </el-table>
    <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pamars.page" :page-sizes="[10, 20, 50, 100]"
      :page-size="pamars.limit" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
  </div>
</template>

<script>
import seviceApi from '@/api/serviceApi.js'
export default {
  data () {
    return {
      pamars: {
        page: 1,
        limit: 10,
        mobile: '',
        name: '',
      },
      totalPage: 0,
      dataList: [],
    }
  },
  created () {
    this.getList()
  },
  methods: {
    getList () {
      seviceApi.getContributionList(this.pamars).then(res => {
        if (res && res.data.code == 200) {
          this.dataList = res.data.page.list
          this.totalPage = res.data.page.totalCount
        }
      })
    },
    // 每页数
    sizeChangeHandle (val) {
      this.pamars.limit = val
      this.getList()
    },
    // 当前页
    currentChangeHandle (val) {
      this.pamars.page = val
      this.getList()
    },
    // 查询
    getDataList () {
      this.pamars.page = 1
      this.getList()
    },
    resetPamars () {
      this.$refs.pamarsRef.resetFields()
      this.getDataList()
    },
  }
}
</script>

<style lang="scss" scoped></style>